<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<%@ include file="/WEB-INF/views/include/head.jsp"%> 
<link rel="stylesheet" href="${ctxStatic}/css/common_erp.css">
<link rel="stylesheet" href="${ctxStatic}/css/list.css">
<script type="text/javascript">
    $(document).ready(function() {
		
		searchListForm();
		
            $(".tabBox ul li").each(function(){
                var index=$(this).index();

                $(".tabBox ul li").eq(0).addClass("active");

                $(this).click(function(){

                    $(this).addClass("active").siblings().removeClass("active");
                    
                    $("#tabPageStatus").val($(this).val());
                    searchListForm();
                    
                    $(".tabBoxSm > .tabSm").eq(index).stop(true).show().siblings().stop(true).hide();
					
					var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
					var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
					var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
					if(tabodyH>tableScrollH){
						$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px')
					}else{
						$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit')
					}

                })

            })

        });
    
    // 检索方法
	function searchListForm() {
		var params = $("#searchForm").serialize();
		$("#activity_pane").showLoading();
		$.post("${ctx}/purchase/handbook/searchList",params,function(result) {
					var listHtml = result["handbook"];
					var pageHtml = result["page"];
					$("#listHtml").html(listHtml);
					$("#paging").html(pageHtml);
					$("#activity_pane").hideLoading();
				}, 'json');
	}
	
	// 重置方法
	function clearParam() {
		$("#handbookNo").val("");
		$("#customerContractNo").val("");
		searchListForm();
	}
	
    $(document).keydown(function(event){
    	if(event.keyCode == 13){
    		searchListForm();
    	}
    }); 
</script>
</head>
<body>
<form id="searchForm" method="post">
<div class="listArea" id="activity_pane">
	<div class="listBg">
        <div class="searchArea clearfix">
            <div class="searchLeft clearfix">
                <div class="searchInp clearfix">
                    <p><spring:message code="handBook_search_handbook_no"/></p>
                    <input type="text" class="w-styleNub" id="handbookNo" name="handbookNo">
                </div>
                <div class="searchInp clearfix">
                    <p><spring:message code="handBook_search_indent_no"/></p>
                    <input type="text" class="w-styleNub" id="customerContractNo" name="customerContractNo">
                </div>
            </div>
            <div class="searchRight clearfix">
                <button type="button" onclick="searchListForm();"><spring:message code="commom_check"/></button>
                <button type="button" onclick = "clearParam()"><spring:message code="common_reset"/></button>
                <button type="button" onclick="popup('900px','584px','${ctx}/purchase/handbook/form')"><spring:message code="common_create"/></button>
            </div>
        </div>
    </div>
    <input type="hidden" id="tabPageStatus" name="tabPageStatus" value="0"/>
    <div class="tabBox">
        <ul class="clearfix">
            <li class="active" value="0"><spring:message code="handBook_tab_all"/></li>
            <li value="5"><spring:message code="handBook_tab_new"/></li>
            <li value="1"><spring:message code="handBook_tab_wait"/></li>
            <li style="width:100px;" value="2"><spring:message code="handBook_tab_ok"/></li>
            <li style="width:100px;" value="3"><spring:message code="handBook_tab_no"/></li>
            <li value="4"><spring:message code="handBook_tab_del"/></li>
        </ul>
	</div>
    <div class="listBg tabPadding overflowX">
        <div class="tableArea tabBoxSm">
            <div class="tableScroll tabSm" style = "height:600px">
                <table cellpadding="0" class="tableHead" >
                    <thead>
                    <tr>
                        <th><p class="table-No"><spring:message code="handBook_head_no"/></p></th>
                        <th><p class="width-180px"><spring:message code="handBook_head_handbook_no"/></p></th>
                        <th><p class="table-htddh"><spring:message code="handBook_head_indent_no"/></p></th>
                        <th><p class="width-100px"><spring:message code="handBook_head_import_num"/></p></th>
                        <th><p class="width-100px"><spring:message code="handBook_head_import_sum"/></p></th>
                        <th><p class="width-100px"><spring:message code="handBook_head_export_num"/></p></th>
                        <th><p class="width-100px"><spring:message code="handBook_head_export_sum"/></p></th>
                        <th><p class="table-cjz"><spring:message code="handBook_head_audit_user"/></p></th>
                        <th><p class="table-rq"><spring:message code="handBook_head_audit_date"/></p></th>
                    </tr>
                    </thead>
                </table>
                <table cellpadding="0" class="tableBody">
                    <tbody id="listHtml">
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div id = "paging" ></div>
</div>
</form>
</body>
</html>